<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//单纯的后台管理
Route::get('/', function () {
    return redirect()->route('index');
})->middleware('auth');

Auth::routes();

Route::group(['middleware' => ['auth','permission'],'prefix' => 'admin','namespace' => 'Admins'], function ($router) {
	//首页
	$router->get('/', 'IndexController@index')->name("index");
	//控制台
	$router->get('/console/flushCache', 'ConsoleController@flushCache')->name("console.flushCache");
	//菜单
	$router->resource('menu','MenuController');
	//权限
	$router->get('/permission/ajaxIndex','PermissionController@ajaxIndex')->name('permission.ajaxIndex');
	$router->resource('permission','PermissionController');
	//角色
	$router->get('/role/ajaxIndex','RoleController@ajaxIndex')->name('role.ajaxIndex');
	$router->get('/role/auth/{id}','RoleController@auth')->name('role.auth');
	$router->post('/role/authpost/{id}','RoleController@authpost')->name('role.authpost');
	$router->resource('role','RoleController');
	//用户
	$router->get('/user/ajaxIndex','UserController@ajaxIndex')->name('user.ajaxIndex');
	$router->post('/user/reset/{id}','UserController@resetPsd')->name('user.reset');
	$router->resource('user','UserController');
	//个人中心
	$router->get('/personal','PersonalController@index')->name('personal.index');
	$router->post('/personal/save','PersonalController@save')->name('personal.save');
	$router->get('/personal/psd','PersonalController@psd')->name('personal.psd');
	$router->post('/personal/psdsave','PersonalController@psdsave')->name('personal.psdsave');
	
});
